﻿using System;

namespace LazyMapper.Core
{
    public class MappingOption<TInput, TType> : IMappingOption<TInput, TType>
    {
        private Func<TInput, TType> _mapCall;
        private bool _ignore;

        public void MapFrom(Func<TInput, TType> mapCall)
        {
            if (mapCall == null) throw new ArgumentNullException("mapCall");
            _mapCall = mapCall;
        }

        public void Ignore()
        {
            _ignore = true;
        }

        public bool IsIgnored
        {
            get { return _ignore; }
        }

        public TType GetObj(TInput input)
        {
            return _mapCall(input);
        }
    }
}